author Rick Andrasek
name FlagFndr
iff code howitzer
 
start1:
scan perimeter
if scan found enemy then discharge energy
if scan found flag then goto
nflag
move forward
goto start1
 
;---  N_Flag  Used for flag found on
scan perimeter
 
nflag:
cross scan
if scan found flag then goto
csflag
scan position 2
if scan found flag then goto gone
scan position 4
if scan found flag then goto gose
scan position 6
if scan found flag then goto gosw
scan position 8
if scan found flag then goto gonw
;--  If get to here, flag was taken
goto start1
 
;------  NOTE: if flag is taken, endless
loop
 
csflag:
scan forward
if scan found flag then goto
scfoundflag
turn left
;-- make sure it's still there
cross scan
if scan found flag then goto
csflag
goto start1
 
scfoundflag:
if value #cur_life = 0 then goto
de4flag
move forward
goto start1
 
de4flag:
move backward
discharge energy
move forward
move forward
goto start1
;----------------------------
 
gone:
if facing north then goto movenen
if facing east then goto movenee
if facing south then goto movenes
;facing west
goto movenew
 
gonw:
if facing north then goto movenee
if facing east then goto movenes
if facing south then goto movenew
goto movenen
 
gose:
if facing north then goto movenew
if facing east then goto movenen
if facing south then goto movenee
goto movenes
 
gosw:
if facing north then goto movenes
if facing east then goto movenew
if facing south then goto movenen
goto movenee
;----------------------------
 
movenen:
  if value #cur_life = 0 then goto
xxhxv5
 
xxhxv5r:
move forward
turn right
move forward
goto start1
 
xxhxv5:
move backward
discharge energy
move forward
goto xxhxv5r
 
movenee:
if value #cur_life = 0 then goto
xxhxv4
 
xxhxv4r:
move forward
turn left
move forward
goto start1
 
xxhxv4:
move backward
discharge energy
move forward
goto xxhxv4r
 
movenew:
if value #cur_life = 0 then goto
xxhxv3
 
xxhxv3r:
move backward
turn right
move forward
goto start1
 
xxhxv3:
move forward
discharge energy
move backward
goto xxhxv3r
 
movenes:
if value #cur_life = 0 then goto
xxhxv2
 
xxhxv2r:
move backward
turn left
move forward
goto start1
 
xxhxv2:
move forward
discharge energy
move backward
goto xxhxv2r